import { PageData } from '@/types/resp'
import request from '@/utils/request'
import {
  Timeline,
  TimelinePageParam,
  TimelineSaveOrUpdateParam,
  TimelinePushParam,
  TimelineRemoveParam,
} from '@/types'

export const page = (param: TimelinePageParam): Promise<PageData<Timeline>> => {
  return request({
    url: '/timeline/page',
    method: 'post',
    data: param,
  })
}

export const saveOrUpdate = (param: TimelineSaveOrUpdateParam): Promise<PageData<Timeline>> => {
  return request({
    url: '/timeline/saveOrUpdate',
    method: 'post',
    data: param,
  })
}

export const push = (param: TimelinePushParam): Promise<unknown> => {
  return request({
    url: '/timeline/push',
    method: 'post',
    data: param,
  })
}

export const remove = (param: TimelineRemoveParam): Promise<unknown> => {
  return request({
    url: '/timeline/remove',
    method: 'post',
    data: param,
  })
}
